﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PAList.aspx.cs" Inherits="Com.CMS263.Web.manage.ProdAttr.PAList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../style/style.css" rel="Stylesheet" type="text/css" />
    <link href="../common/validator.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>

    <script language="javascript" type="text/javascript" src="/manage/js/js_global.js"></script>

    <script language="javascript" type="text/javascript" src="/manage/js/js_extlib.js"></script>

    <script language="javascript" type="text/javascript" src="/manage/js/pager.js"></script>

    <script type="text/javascript" language="javascript">
        function del(id, obj) {
                $.post("ProdAttAction.aspx?op=delpt", { id: id }, function(data) {
                    if (data == "ok") {
                        alert('删除成功');
                        $(obj.parentNode.parentNode).remove();
                    }
                    else {
                        alert("操作失败");
                    }
                })
        }
        function seldel(id, obj) {
            $.post("ProdAttAction.aspx?op=cha", { id: id }, function(data) {
                if (data == "you") {
                    if (confirm('删除该商品类型，所属该商品的扩展属性和相关商品属性都将被删除，这是一个不可逆的操作请妥善进行，您真的要删除此条记录？')) {
                        del(id, obj);
                    }
                }
                if (data == "wu") {
                    if (confirm('这是一个不可逆的操作，真的要删除此条记录')) {
                        del(id, obj);
                    }
                }
            })
        }
        function editItem(id, page, key) {
            window.location.href = "ModPa.aspx?id=" + id + "&page=" + page;
        }
        function editAttr(prodtypeId,page) {
            window.location.href = "ProdTypeAtt.aspx?ptid=" + prodtypeId + "&page=" + page;
        }
        function changeUse(id) {
            var flag = $("#hi" + id).val();
            $.post("ProdAttAction.aspx?op=chuse&code=" + Math.random(1000), { id: id, flag: flag }, function(data) {

                if (data == "yes") {
                    $("#img" + id).attr("src", "/manage/images/yes.png");
                    $("#hi" + id).val("1");
                }
                else {
                    $("#img" + id).attr("src", "/manage/images/no.png");
                    $("#hi" + id).val("0");
                }
            })
        }
    </script>

    <style type="text/css">
        .style1
        {
            height: 394px;
        }
    </style>
</head>
<body style="background-color: #ffffff;">
    <form id="form1" runat="server">
    <div>
        <table border="0" cellspacing="0" cellpadding="0" class="dstable">
            <tr>
                <td height="23" class="table_2">
                    <asp:Label ID="lbTypeName" runat="server"></asp:Label>
                    管理
                </td>
            </tr>
            <tr>
                <td class="tdside" align="left">
                    <a href="ModPa.aspx?id=0">添加新类型</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    搜索:<asp:TextBox ID="txtKey" runat="server"></asp:TextBox>
                    <asp:Button ID="Button1" runat="server" Text="搜索" OnClick="Button1_Click" />
                    <br />
                </td>
            </tr>
            <tr>
                <td>
                    <table border="0" cellspacing="0" cellpadding="0" class="n_dstable">
                        <thead class="data_th">
                            <tr style="text-align: center">
                                <td>
                                    编号
                                </td>
                                <td>
                                    类型名称
                                </td>
                                <td>
                                    是否启用
                                </td>
                                <td>
                                    操作
                                </td>
                            </tr>
                        </thead>
                        <tbody class="data_tb">
                            <% foreach (Com.CMS263.PO.ProdType art in pt)
                               { %>
                            <tr class="tr_odd" onmouseover="trColor(this);" onmouseout="trColor(this);">
                                <td class="qian">
                                    <%=art.Id %>
                                </td>
                                <td class="qian">
                                    <a title="<%=art.TypeName %>">
                                        <%=Com.CMS263.Util.StringUtil.GetText(Com.CMS263.Util.StringUtil.CleanAll(art.TypeName), 15)%></a>
                                </td>
                                <td class="qian">
                                    <input type="hidden" id="hi<%=art.Id %>" name="hi<%=art.Id %>" value='<%=Convert.ToInt32(art.IsUse) %>' />
                                    <a style="cursor: pointer">
                                        <img id="img<%=art.Id %>" onclick='changeUse(<%=art.Id %>)' src='/manage/images/<%=art.IsUse==true?"yes.png":"no.png"%>' /></a>
                                </td>
                                <td class="qian">
                                    <input type="button" class="btn4_out" onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'"
                                        onclick="editAttr(<%=art.Id %>,<%=Convert.ToInt32(Request["page"]) %>)" value="修改属性" />&nbsp;&nbsp;
                                    <input type="button" class="btn4_out" onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'"
                                        onclick='editItem(<%=art.Id %>,<%=Convert.ToInt32(Request["page"]) %>)' value="编辑" />
                                    &nbsp;&nbsp;<input type="button" class="btn4_out" onmouseover="this.className='btn4_over'"
                                        onmouseout="this.className='btn4_out'" onclick="seldel(<%=art.Id %>,this)" value="删除" />&nbsp;&nbsp;
                                </td>
                            </tr>
                            <%} %></tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <%=GetPager() %>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
